# coding:utf-8

import requests

class TestRequest:
    def basicUsage(self):
        r = requests.get('http://www.baidu.com')
        # print(r.encoding)
        print(r.content)
        # print(r.json())

    def proxiesUsage(self):
        proxies = {'http':'182.119.204.214:8118',
                   'http': '114.231.116.251:808'}
        r = requests.get('http://www.baidu.com',proxies)
        print(r.content)

    def cookiesUsage(self):
            session = requests.session()
            headers = {
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36'}
            auth_info = {'email': 'xxx@qq.com',
                              'password': 'xxx'}
            session.post('http://www.renren.com/PLogin.do', data=auth_info)

            # 获取主页信息
            response = session.get('http://www.renren.com/577842170/profile?v=info_timeline')
            print(response.content)

    def nouseCookieUsage(self):
        # r = requests.get('https://www.12306.cn/mormhweb/')
        r = requests.get('https://www.12306.cn/mormhweb/',verify = False)
        print(r.content)

if __name__ == '__main__':
    t = TestRequest()
    # t.basicUsage()
    # t.proxiesUsage()
    t.nouseCookieUsage()